package com.nb82.entity;

import java.util.HashMap;
import java.util.Map;

import android.os.Handler;

import com.nb82.core.KennerControll.TaskListener;
public class Task extends BaseBean{
	public int taskId = 0;
	public Class clazz;
	public Object obj;
	public String method;
	public String action;
	public Handler handler;
	public long startTime;
	public long completeTime;
	public Map<String, Object> params = new HashMap<String, Object>();
	private TaskListener listener;
	public Task() {
		// TODO Auto-generated constructor stub
	}
	public Task(Class clazz,String method,TaskListener listener){
		this.clazz = clazz ;
		this.method = method;
		this.listener = listener;
				
	}
	public Task(Class clazz,String method,Handler handler,TaskListener listener){
		this.clazz = clazz ;
		this.method = method;
		this.handler = handler;	
		this.listener = listener;
	}
	public Task(Integer id,Class clazz,String method,Handler handler,TaskListener listener){
		this.taskId = id;
		this.clazz = clazz ;
		this.method = method;
		this.handler = handler;		
		this.listener = listener;
	}
	public Task(Integer id,Class clazz,String method,Handler handler,Map<String, Object> params,TaskListener listener){
		this.taskId = id;
		this.clazz = clazz ;
		this.method = method;
		this.handler = handler;		
		this.params = params;
		this.listener = listener;
	}
	public TaskListener getListener() {
		return listener;
	}
	public void setListener(TaskListener listener) {
		this.listener = listener;
	}
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return "taskId :" + taskId +"\nclazz:" + clazz.getName() +"\nmethod:" + method + "\nstartTime:" +startTime + "    completeTime" + completeTime + "\nhandler:" +(handler!= null ? handler.getClass().getName():"") + "\naction:" + (action != null ?action :"");
	}
	
	
}
